package handler

import (
	"gin/global"
	"github.com/gin-gonic/gin"
	"net/http"
	user "user_srv/proto"
)

func Login(c *gin.Context) {
	mobile := c.PostForm("mobile")
	password := c.PostForm("password")
	login, err := global.UserClient.Login(c, &user.LoginRequest{
		Mobile:   mobile,
		Password: password,
	})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"message": "登录失败"})
		return
	}
	c.JSON(http.StatusOK, gin.H{"message": "登录成功", "data": login})
}
